var bfb

///////////////////////////////////////////////////////////////////////////////////////////////////
function stopScrolling(touchEvent) {
    if (1 == 1) {
        return
    }
    touchEvent.preventDefault();
}

var canvas, stage, exportRoot, loader, messageField;

function bt() {

}


function bt2() {

    document.getElementsByTagName("body")[0].setAttribute("style", "magin:0px")
    document.body.style.margin = "0px"
    var tx = document.documentElement.clientWidth
    var ty = 1150 * (document.documentElement.clientWidth / 720)
    canvas.width = 720
    canvas.height = 1294


    var tyy = document.documentElement.clientHeight


    document.getElementById("canvas").style.width = 720 + "px"
    document.getElementById("canvas").style.height = tyy + "px"


}

function init() {

    canvas = document.getElementById("canvas");
    images = images || {};


    document.addEventListener('touchstart', stopScrolling, false);
    document.addEventListener('touchmove', stopScrolling, false);

// loading
    stage = new createjs.Stage(canvas);
    createjs.Touch.enable(stage, true, false);

    loader = new createjs.LoadQueue(false);
    loader.installPlugin(createjs.Sound);
    loader.addEventListener("fileload", handleFileLoad);
    loader.addEventListener("complete", handleComplete);
    loader.loadManifest(lib.properties.manifest);
    loader.addEventListener("progress", updateLoading);

    function updateLoading() {


        bfb = (0 | 100 * loader.progress)


        if (bfb == 100) {

            endfun1()

        }

        stage.update();
    }
}

function handleFileLoad(evt) {
    if (evt.item.type == "image") {
        images[evt.item.id] = evt.result;
    }
}

var allstop = false

function handleComplete() {
    var ggasdfasdf = document.documentElement.clientWidth
    canvas.height = Math.ceil(document.documentElement.clientHeight * (720 / document.documentElement.clientWidth))

    exportRoot = new lib.index();
    stage.addChild(exportRoot);
    createjs.Ticker.setFPS(lib.properties.fps);
    createjs.Ticker.addEventListener("tick", stage);
    stage.update();


}

function playSound(id, loop) {
    createjs.Sound.play(id, createjs.Sound.INTERRUPT_EARLY, 0, 0, loop);
}
